widget: Add private get_margin_allocation
authorTimm Bäder <mail@baedert.org>
Fri, 5 May 2017 16:24:52 +0000 (18:24 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 20 Jul 2017 01:27:12 +0000 (21:27 -0400)
gtk/gtkwidget.c
gtk/gtkwidgetprivate.h

index ea8fa4c153e1287044958117887529b91fd99857..649edb3844db56f862cd2e0c9fd15af1b75caf16 100644 (file)
@@ -13672,6 +13672,26 @@ gtk_widget_get_border_allocation (GtkWidget     *widget,
                         margin.bottom + border.bottom;
 }
 
+void
+gtk_widget_get_margin_allocation (GtkWidget     *widget,
+                                  GtkAllocation *allocation)
+{
+  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
+  GtkBorder margin, border;
+  GtkCssStyle *style;
+
+  style = gtk_css_node_get_style (priv->cssnode);
+  get_box_margin (style, &margin);
+  get_box_border (style, &border);
+
+  *allocation = priv->allocation;
+
+  allocation->x += margin.left;
+  allocation->y += margin.top;
+  allocation->width -= margin.left + margin.right;
+  allocation->height -= margin.top + margin.bottom;
+}
+
 /**
  * gtk_widget_set_allocation:
  * @widget: a #GtkWidget
index e9acd9acf31dde5888ec6481b6b503b72c2a9eb6..6702c8653f7a13c1362c200653ee7a9214d7152e 100644 (file)
@@ -322,6 +322,9 @@ void              gtk_widget_get_content_allocation        (GtkWidget        *wi
                                                             GtkAllocation    *allocation);
 void              gtk_widget_get_border_allocation         (GtkWidget        *widget,
                                                             GtkAllocation    *allocation);
+void              gtk_widget_get_margin_allocation         (GtkWidget        *widget,
+                                                            GtkAllocation    *allocation);
+
 
 GtkWidget *       gtk_widget_common_ancestor               (GtkWidget *widget_a,
                                                             GtkWidget *widget_b);